import request from '@/utils/request'

// 查询报修信息列表
export function listRepair(query) {
  return request({
    url: '/system/repair/list',
    method: 'get',
    params: query
  })
}

// 查询报修信息详细
export function getRepair(repairId) {
  return request({
    url: '/system/repair/' + repairId,
    method: 'get'
  })
}

// 新增报修信息
export function addRepair(data) {
  return request({
    url: '/system/repair',
    method: 'post',
    data: data
  })
}

// 修改报修信息
export function updateRepair(data) {
  return request({
    url: '/system/repair',
    method: 'put',
    data: data
  })
}

// 删除报修信息
export function delRepair(repairId) {
  return request({
    url: '/system/repair/' + repairId,
    method: 'delete'
  })
}

// api/zy/repair.js
export function completeRepair(repairId) {
  return request({
    url: '/system/repair/process',
    method: 'post',
    data: {
      repairId,
      completeId: 2001, // 假设维修人员ID
      completePhone: "13800138001",
      completeName: "维修人员A",
      completeTime: new Date().toISOString().slice(0, 10)
    }
  });
}

export function rejectRepair(repairId, remark) {
  return request({
    url: '/system/repair/reject',
    method: 'post',
    data: {
      repairId,
      reviewResult: "驳回",
      reviewRemark: remark
    }
  });
}
